<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* var obj = {
            name:'tom',
            age:18
        }
        var name = obj.name;
        var age = obj.age;
        console.log(name,age); */

        /* let obj = {
            name:'tom',
            age:18
        }
        let name = obj.name;
        let age = obj.age; */
        /* let {name,age} = {
            name:'tom',
            age:18
        }  */
        // let {sex,jiguan,zheshu} = {sex:'nv',jiguan:'石家庄',zheshu:'很苗条'}
        // console.log(sex,jiguan,zheshu);
        // console.log(name,age);
        // let {name:name1} = {
        //     name:'zheshu'
        // }
        // let {}
        // console.log(name1);

       /*  var name_1 = 'zheshu';
        var name_2 = name_1;
        console.log(name_2); */

        // let obj_new = {
        //     name:'tom',
        //     age:18,
        //     sex:'nan'
        // }
        // let name = obj_new.name;

        // let {name}= obj_new;
        // console.log(name);

        // 
       /*  function foo({name,age}){
            console.log(name,age);
        }
        foo({name:'tom',age:18}); */
        /* function foo(obj){
            console.log(obj.name);
            console.log(obj.age);
        } */
        // function foo({name,age}){//{name:name,age:age} = {name='tom',age=18} 
        //     console.log(name);
        //     console.log(age);
        // }
        // foo({name:'tom',age:18});


        /* let obj = {
            name:'tom',
            age:18
        }  */
        /* let name = obj.name;
        let age = obj.age; */
        // let {name,age} = obj;
        // console.log(name,age);

        // let hobby = '足球、篮球、乒乓球';
        /* let obj_new = {
            name:'tom',
            hobby:hobby
        } */
        /* let obj_new = {
            name:'tom',
            hobby,
            jump:function(){
                console.log('xx');
            }
        } */
        // 对象的简写方式 省略同名的属性值 省略关键字function
        /* let obj_new = {
            name:'tom',
            hobby,
            jump(){
                console.log('xx');
            }
        } 
        console.log(obj_new);
        obj_new.jump(); */

        let arr = [1,2,'kkk',45];
        console.log(arr[0],arr[1]);
        // 默认值
        let [a,b,c,d,f='222'] = arr;
        console.log(a,b,c,d,f);
        /* 
        var a = arr[0]
        var b = arr[1]
        var c = arr[2]
        var d = arr[3]
        var f = arr[4]
        */
        let [,,,e] = arr;
        console.log(e);

        // 变量名不能是数字
        

    </script>
</body>
</html>